/// </summary>
public class SuperPolarity : Game
{
- GraphicsDeviceManager graphics;
+ public GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
- MainShip player;
+ public static int OutlierBounds;
+
+ public Player Player;
+
+ Screen EntryScreen;
+
+ SpriteFont DebugFont;
public SuperPolarity()
: base()
{
graphics = new GraphicsDeviceManager(this);
+ graphics.PreferMultiSampling = true;
+ graphics.PreferredBackBufferWidth = 1280;
+ graphics.PreferredBackBufferHeight = 720;
+ graphics.ToggleFullScreen();
+
Content.RootDirectory = "Content";
+ ActorFactory.SetGame(this);
+ ParticleEffectFactory.SetGame(this);
+ ActorManager.SetGame(this);
+ ScreenManager.SetGame(this);
+
+ EntryScreen = (Screen)new GameScreen(this);
}
/// <summary>
/// </summary>
protected override void Initialize()
{
- player = new MainShip();
-
base.Initialize();
+
+ InputController.RegisterEventForKey("fullScreenToggle", Keys.F11);
+ InputController.Bind("fullScreenToggle", HandleFullScreenToggle);
+
+ EntryScreen.Initialize();
+ ScreenManager.Push(EntryScreen);
+
+ OutlierBounds = 100;
+ }
+
+ protected void HandleFullScreenToggle(float value)
+ {
+ graphics.ToggleFullScreen();
+ graphics.ApplyChanges();
}
/// <summary>
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
- Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
+ EntryScreen.LoadContent();
- player.Initialize(Content.Load<Texture2D>("Graphics\\player"), playerPosition);
+ Player = new Player();
+ DebugFont = Content.Load<SpriteFont>("Fonts\\SegoeUIMono14");
}
/// <summary>
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
- // TODO: Add your update logic here
+ ScreenManager.Update(gameTime);
base.Update(gameTime);
}
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
- GraphicsDevice.Clear(Color.CornflowerBlue);
+ GraphicsDevice.Clear(Color.White);
spriteBatch.Begin();
- player.Draw(spriteBatch);
+ ScreenManager.Draw(spriteBatch);
+
+ spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray);
+ spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray);
+ spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray);
spriteBatch.End();